//
//  WYDetailHeaderController.m
//  Hangbag
//
//  Created by admin on 2018/2/10.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYDetailHeaderController.h"
#import "WYDetailCell.h"
#import "WYGuessLikeController.h"
@interface WYDetailHeaderController ()

@end

@implementation WYDetailHeaderController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.showsVerticalScrollIndicator = NO;
    [self.tableView registerNib:[UINib nibWithNibName:@"WYDetailCell" bundle:nil] forCellReuseIdentifier:@"WYDetailCell"];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"WYGuessLikeController"];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
    if (!self.vcCanScroll) {
        scrollView.contentOffset = CGPointZero;
    }
    if (scrollView.contentOffset.y <= 0) {
        self.vcCanScroll = NO;
        scrollView.contentOffset = CGPointZero;
        //到顶通知父视图改变状态
        [[NSNotificationCenter defaultCenter] postNotificationName:@"leaveTop" object:nil];
    }
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 15;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row==0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WYGuessLikeController" forIndexPath:indexPath];
        
        [cell.contentView removeAllSubviews];
        WYGuessLikeController *glc = [[WYGuessLikeController alloc]init];
        [cell.contentView addSubview:glc.view];
        return cell;
        
    }
    
    
    
    WYDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WYDetailCell" forIndexPath:indexPath];
    if (!cell) {
        cell = [[NSBundle mainBundle]loadNibNamed:@"WYDetailCell" owner:nil options:nil].firstObject;
    }

    
    
    
    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==14) {
        return kScreenHeight;
    }
    return 320;
}




@end
